]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
osdWindow: relayout when scale factor changes
authorCosimo Cecchi <cosimoc@gnome.org>
Mon, 10 Oct 2016 23:56:35 +0000 (16:56 -0700)
committerCosimo Cecchi <cosimoc@gnome.org>
Tue, 11 Oct 2016 00:24:52 +0000 (17:24 -0700)
We currently rely on the "monitors-changed" signal of LayoutManager to
relayout the OSD window. That is not enough, since the scale factor also
changes the way the OSD window is sized, and that can be updated after
"monitors-changed" has been received.
The visual effect is that under some circumstances, the OSD window will
have the wrong size under HiDpi.

This commit fixes the issue by triggering another relayout when the
scale factor changes.

https://bugzilla.gnome.org/show_bug.cgi?id=772723

js/ui/osdWindow.js

index 4cb0f7b4f9da1a7f1b61f99581ded9e85cd70d80..432ea9af73095a1ec1f2d91f976cd612ab7b79c2 100644 (file)
@@ -109,8 +109,11 @@ const OsdWindow = new Lang.Class({
         this._reset();
 
         Main.layoutManager.connect('monitors-changed',
-                                   Lang.bind(this, this._monitorsChanged));
-        this._monitorsChanged();
+                                   Lang.bind(this, this._relayout));
+        let themeContext = St.ThemeContext.get_for_stage(global.stage);
+        themeContext.connect('notify::scale-factor',
+                             Lang.bind(this, this._relayout));
+        this._relayout();
         Main.uiGroup.add_child(this.actor);
     },
 
@@ -188,7 +191,7 @@ const OsdWindow = new Lang.Class({
         this.setLevel(null);
     },
 
-    _monitorsChanged: function() {
+    _relayout: function() {
         /* assume 110x110 on a 640x480 display and scale from there */
         let monitor = Main.layoutManager.monitors[this._monitorIndex];
         if (!monitor)